<%@ page import="java.sql.ResultSet" %>

<%@ include file="connect.jsp" %>

<%
    String learnName = request.getParameter("namalearn");
    String paragraf = request.getParameter("paragraf");
    String kategori = learnName.substring(0, learnName.indexOf('_'));

    stat.executeUpdate("INSERT INTO Learn (LearnName,Paragraph,categoryID) select '" + learnName + "','" + paragraf + "',categoryId from categories where lower(categoryName)=lower('" + kategori + "')");
    response.sendRedirect("learn.jsp?respon=Successfully added " + learnName);
    conn.close();
%>